package br.com.projeto;

import android.app.Application;
import android.content.Context;
import br.com.projeto.dao.DatabaseHelper;

public class MegaSenaApplication extends Application {

	private static DatabaseHelper dataBaseHelper = null;
	private static Context context;

	public static final int HANDLE_SAVE_OK = 1;
	public static final int HANDLE_SAVE_ERRO = 2;
	public static final int HANDLE_SAVE_VALIDATE = 3;
	public static final int HANDLE_LIST_OK = 4;
	public static final int HANDLE_SYNC_OK = 5;
	public static final int HANDLE_SYNC_ERRO_JSON = 6;
	public static final int HANDLE_SYNC_ERRO_JSOUP = 7;
	public static final int HANDLE_SYNC_ERRO_GENERIC = 8;
	public static final int HANDLE_SERVER_ERRO = 9;
	public static final int HANDLE_APPLICATION_OFFLINE = 10;
	public static final int HANDLE_DELETE_OK = 11;
	public static final int HANDLE_DELETE_ERRO = 12;
	public static final int HANDLE_UPDATE_OK = 13;
	
	@Override
	public void onCreate() {
		super.onCreate();

		if (dataBaseHelper == null) {
			dataBaseHelper = DatabaseHelper.getHelper(this);
		}

		if (context == null) {
			context = this;
		}
		getDataBaseHelper().getWritableDatabase();
	}

	public static DatabaseHelper getDataBaseHelper() {
		return dataBaseHelper;
	}
}
